const Router = require('koa-router');
const { verifyAuth,verifyPermission } = require('../middleware/auth.middleware');
const {create,detail,list,update,remove,addLabels} = require('../controller/moment.controller')
const {verifyLabelExists} = require('../middleware/label.middleware')

const momentRouter = new Router({prefix: '/moment'})

momentRouter.post('/',verifyAuth,create)
momentRouter.get('/:momentId', detail)
momentRouter.get('/',list)
momentRouter.patch('/:momentId',verifyAuth,verifyPermission, update)
momentRouter.delete('/:momentId',verifyAuth,verifyPermission,remove)
// 给动态添加标签接口
momentRouter.post('/:momentId/labels',verifyAuth,verifyPermission,verifyLabelExists,addLabels)

module.exports = momentRouter